package com.jenkins.test.proxy.gov.dto;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * @version V1.0.0
 * @ClassName: {@link GovResponse}
 * @Description: GovResponse
 * @author: Lanzhou
 * @date: 2022/1/22 8:50
 * @Copyright:2020 All rights reserved.
 */
@Setter
@Getter
@ToString
public class GovResponse {

    /**
     * 返回码，详见:
     * 返回码 说明
     * 0 请求成功
     * E1001 平台服务异常
     * E1002 服务器数据库异常
     * E2001 请求参数异常，缺少必填项
     * E2002 请求参数异常，参数格式不合法
     */
    private String responseCode;

    /**
     * 状态提示
     */
    private String responseMessage;

    /**
     * 数据
     */
    private Object data;

    /**
     * 快速失败
     *
     * @param message
     * @return
     */
    public static GovResponse fastFail(String message) {
        GovResponse response = new GovResponse();
        response.setResponseCode("E500");
        response.setResponseMessage(message);
        return response;
    }

    /**
     * 快速失败
     *
     * @param message
     * @param obj
     * @return
     */
    public static GovResponse fastFail(String message, Object obj) {
        GovResponse response = new GovResponse();
        response.setResponseCode("E500");
        response.setResponseMessage(message);
        response.setData(obj);
        return response;
    }


}
